package com.woniu.adapter;

import com.woniu.outlet.mysql.po.DailyCodeTOne;
import com.woniu.outlet.redis.DailyCodeValuationRedisDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class DailyCodeValuationAdapter {

    @Autowired
    private DailyCodeValuationRedisDao dailyCodeValuationRedisDao;

    /**
     * 根据code从redis中获取净值
     * @param code 产品编号
     * @return
     */
    public DailyCodeTOne getDailyCodeValuationMySQL(String code) {
        return dailyCodeValuationRedisDao.findById(code).orElseThrow(NullPointerException::new);
    }
}
